package com.xuxin.baby.presenter;

import com.xuxin.baby.bean.BaseBean;
import com.xuxin.baby.bean.ChildEatingBean;
import com.xuxin.baby.contract.ChildEatingContract;
import com.xuxin.baby.model.ChildEatingModel;

/**
 * Created by xu_xin
 * Created on 2020/10/22 0022
 * 喂养记录
 */
public class ChildEatingPresenter implements ChildEatingContract.Presenter {
    private  final ChildEatingModel model;
    private  final ChildEatingContract.View view;

    public ChildEatingPresenter(ChildEatingContract.View view) {
        this.view = view;
        model = new ChildEatingModel();
    }

    @Override
    public void getChildEating(String tenantId, String token, String childId, int skipCount) {
        if (null != model) {
            model.getChildEating(this, tenantId, token, childId, skipCount);
        }
    }

    @Override
    public void onSuccess(ChildEatingBean childEatingBean) {
        if (null != view) {
            view.onSuccess(childEatingBean);
        }
    }

    /**
     * 以下内容复用(用于请求完成后的操作)
     */
    @Override
    public void onError(BaseBean baseBean) {
        if (null != view) {
            view.onError(baseBean);
        }
    }

    @Override
    public void onComplete() {
        if (null != view) {
            view.onComplete();
        }
    }
}